=====In Windows OS=====

To build the MEX function in Matlab in order to reuse the C code for hydraulic simulation:

1. copy modified " epanet2mex.h " to the directory like " C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include ";

2. copy re-compiled lib file " epanet2.lib " to the directory like " C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib ";

3. call " mex -setup " in Matlab to configure the complier;

4. choose the " Microsoft Visual C++ 2010 Express " or a similar complier rather than the default one " Lcc " (you may need to download the free compiler from the official site of Microsoft);

5. call " mex -v TLN2obj.c -L"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib" -lepanet2 -I"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" " to build the mex function;

6. pay attention to the format of function usage, it should be called like " [objs, constrs]=TLN2obj(vars, NFE) ", in which " vars " represents a 1-by-numOfPipes vector and " NFE " represents the total number of function evaluations.
